﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QKen.SPA.Common.Utility
{
    [Serializable]
    public class UserTokenData
    {
        public UserTokenData() { }

        public UserTokenData(Guid UserID, string UserName)
        {
            this.userID = UserID;
            this.userName = UserName;
        }

        private Guid userID;
        public Guid UserID
        { 
            get { return userID; }
        }

        private string userName;
        public string UserName
        {
            get { return userName; }
        }

        public void BuildUserData(string userData)
        {
            if (!string.IsNullOrEmpty(userData))
            {
                string[] fields = userData.Split(',');
                this.userID = new Guid(fields[0]);
                this.userName = fields[1];
            }
        }

        public string GetUserData()
        {
            return string.Format("{0},{1}", userID, userName);
        }

        public override string ToString()
        {
            return GetUserData();
        }
    }
}
